<!doctype html><html lang dir=ltr><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><title>Vulfocus 搭建指南 | Hui.Ke - Blog</title><meta name=generator content="Hugo Eureka 0.9.3"><link rel=stylesheet href=https://b.hui.ke/css/eureka.min.9cec6350e37e534b0338fa9a085bf06855de3b0f2dcf857e792e5e97b07ea905d4d5513db554cbc26a9c3da622bae92d.css><script defer src=https://b.hui.ke/js/eureka.min.fa9a6bf6d7a50bb635b4cca7d2ba5cf3dfb095ae3798773f1328f7950028b48c17d06276594e1b5f244a25a6c969a705.js></script>
<link rel=preconnect href=https://fonts.googleapis.com><link rel=preconnect href=https://fonts.gstatic.com crossorigin><link rel=preload href="https://fonts.googleapis.com/css2?family=Lora:wght@400;600;700&family=Noto+Serif+SC:wght@400;600;700&display=swap" as=style onload='this.onload=null,this.rel="stylesheet"'><link rel=stylesheet href=https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/styles/vs.min.css media=print onload='this.media="all",this.onload=null' crossorigin><script defer src=https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/highlight.min.js crossorigin></script>
<script defer src=https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/languages/bash.min.js crossorigin></script>
<script defer src=https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/languages/ini.min.js crossorigin></script>
<script defer src=https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/languages/json.min.js crossorigin></script>
<script defer src=https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/languages/php.min.js crossorigin></script>
<script defer src=https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/languages/python.min.js crossorigin></script>
<script defer src=https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/languages/shell.min.js crossorigin></script>
<script defer src=https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/languages/sql.min.js crossorigin></script>
<script defer src=https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/languages/x86asm.min.js crossorigin></script>
<script defer src=https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/languages/xml.min.js crossorigin></script>
<link rel=stylesheet href=https://b.hui.ke/css/highlightjs.min.2958991528e43eb6fc9b8c4f2b8e052f79c4010718e1d1e888a777620e9ee63021c2c57ec7417a3108019bb8c41943e6.css media=print onload='this.media="all",this.onload=null'><script defer type=text/javascript src=https://lib.baomitu.com/font-awesome/6.1.1/js/all.min.js></script>
<link rel=stylesheet href=https://cdn.jsdelivr.net/npm/katex@0.15.2/dist/katex.min.css integrity=sha384-MlJdn/WNKDGXveldHDdyRP1R4CTHr3FeuDNfhsLPYrq2t0UBkUdK2jyTnXPEK1NQ media=print onload='this.media="all",this.onload=null' crossorigin><script defer src=https://cdn.jsdelivr.net/npm/katex@0.15.2/dist/katex.min.js integrity=sha384-VQ8d8WVFw0yHhCk5E8I86oOhv48xLpnDZx5T9GogA/Y84DcCKWXDmSDfn13bzFZY crossorigin></script>
<script defer src=https://cdn.jsdelivr.net/npm/katex@0.15.2/dist/contrib/auto-render.min.js integrity=sha384-+XBljXPPiv+OzfbB3cVmLHf4hdUFHlWNZN5spNQ7rmHTXpd7WvJum6fIACpNNfIR crossorigin></script>
<script>document.addEventListener("DOMContentLoaded",function(){renderMathInElement(document.body,{delimiters:[{left:"$$",right:"$$",display:!0},{left:"$",right:"$",display:!1},{left:"\\(",right:"\\)",display:!1},{left:"\\[",right:"\\]",display:!0}]})})</script><script defer src=https://cdn.jsdelivr.net/npm/mermaid@8.14.0/dist/mermaid.min.js integrity=sha384-atOyb0FxAgN9LyAc6PEf9BjgwLISyansgdH8/VXQH8p2o5vfrRgmGIJ2Sg22L0A0 crossorigin></script>
<link rel=icon type=image/png sizes=32x32 href=https://b.hui.ke/icon_hub7ca0b5404c6d576559b2bd22c64b0e5_2009_32x32_fill_box_center_3.png><link rel=apple-touch-icon sizes=180x180 href=https://b.hui.ke/icon_hub7ca0b5404c6d576559b2bd22c64b0e5_2009_180x180_fill_box_center_3.png><meta name=description content="  在 搭建 vulstudy 的时候无意间发现了一个好像可以作为 CTF 的平台“Vulfocus”，打算也搭一个试试。README 里没看到安装说明，后来百度到了搭建指南在 INSTALL.md 里，于是搬运过来作为博文，便于查看。直接搬运，内容未作改动。

GitHub 项目地址： fofapro/vulfocus
"><script type=application/ld+json>{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Posts","item":"https://b.hui.ke/posts/"},{"@type":"ListItem","position":2,"name":"Vulfocus 搭建指南","item":"https://b.hui.ke/posts/vulfocus-building-guide/"}]}</script><script type=application/ld+json>{"@context":"https://schema.org","@type":"Article","mainEntityOfPage":{"@type":"WebPage","@id":"https://b.hui.ke/posts/vulfocus-building-guide/"},"headline":"Vulfocus 搭建指南 | Hui.Ke - Blog","datePublished":"2020-08-11T09:08:28+08:00","dateModified":"2020-08-11T09:08:28+08:00","wordCount":1695,"author":{"@type":"Person","name":"Hui.ke"},"publisher":{"@type":"Person","name":"Hui.Ke","logo":{"@type":"ImageObject","url":"https://b.hui.ke/icon.png"}},"description":"\u003cp\u003e  在 \u003ca href=\u0022https:\/\/b.hui.ke\/build-vulstudy\/\u0022\u003e搭建 vulstudy\u003c\/a\u003e 的时候无意间发现了一个好像可以作为 CTF 的平台“Vulfocus”，打算也搭一个试试。\u003ca href=\u0022https:\/\/github.com\/fofapro\/vulfocus\/blob\/master\/README.md\u0022\u003eREADME\u003c\/a\u003e 里没看到安装说明，后来百度到了搭建指南在 \u003ca href=\u0022https:\/\/github.com\/fofapro\/vulfocus\/blob\/master\/INSTALL.md\u0022\u003eINSTALL.md\u003c\/a\u003e 里，于是搬运过来作为博文，便于查看。\u003cstrong\u003e直接搬运，内容未作改动\u003c\/strong\u003e。\u003c\/p\u003e\n\u003cblockquote\u003e\n\u003cp\u003eGitHub 项目地址： \u003ca href=\u0022https:\/\/github.com\/fofapro\/vulfocus\u0022\u003efofapro\/vulfocus\u003c\/a\u003e\u003c\/p\u003e\n\u003c\/blockquote\u003e"}</script><meta property="og:title" content="Vulfocus 搭建指南 | Hui.Ke - Blog"><meta property="og:type" content="article"><meta property="og:image" content="https://b.hui.ke/icon.png"><meta property="og:url" content="https://b.hui.ke/posts/vulfocus-building-guide/"><meta property="og:description" content="  在 搭建 vulstudy 的时候无意间发现了一个好像可以作为 CTF 的平台“Vulfocus”，打算也搭一个试试。README 里没看到安装说明，后来百度到了搭建指南在 INSTALL.md 里，于是搬运过来作为博文，便于查看。直接搬运，内容未作改动。

GitHub 项目地址： fofapro/vulfocus
"><meta property="og:site_name" content="Hui.Ke - Blog"><meta property="article:published_time" content="2020-08-11T09:08:28+08:00"><meta property="article:modified_time" content="2020-08-11T09:08:28+08:00"><meta property="article:section" content="posts"><meta property="article:tag" content="vulfocus"><meta property="article:tag" content="Docker"><meta property="og:see_also" content="https://b.hui.ke/posts/data-security-and-personal-information-protection/"><meta property="og:see_also" content="https://b.hui.ke/posts/mp-1/"><meta property="og:see_also" content="https://b.hui.ke/posts/regedit-delete-startup-item/"><meta property="og:see_also" content="https://b.hui.ke/posts/ols-wordpress/"><meta property="og:see_also" content="https://b.hui.ke/posts/epidemic-prevention-and-cyber-security/"><meta property="og:see_also" content="https://b.hui.ke/posts/comparison-of-thin-light-laptops/"><meta property="og:see_also" content="https://b.hui.ke/posts/sangfor-pt1/"><meta property="og:see_also" content="https://b.hui.ke/posts/minutes-of-general-manager-xus-meeting-on-monday/"><meta property="og:see_also" content="https://b.hui.ke/posts/my-github-stars/"><meta property="og:see_also" content="https://b.hui.ke/posts/raspberry-pi-motion/"><meta property="og:see_also" content="https://b.hui.ke/posts/transfer-files-with-rsync/"><meta property="og:see_also" content="https://b.hui.ke/posts/comparison-of-iflytek-mice/"><meta property="og:see_also" content="https://b.hui.ke/posts/resolutions-for-vmware-tools-installation-failure/"><meta property="og:see_also" content="https://b.hui.ke/posts/raspberry-pi-intranet-penetration/"><meta property="og:see_also" content="https://b.hui.ke/posts/image-and-video-optimization/"><meta property="og:see_also" content="https://b.hui.ke/posts/ccia-top-50-2020/"><meta property="og:see_also" content="https://b.hui.ke/posts/cdn-nodes/"><meta property="og:see_also" content="https://b.hui.ke/posts/build-vulstudy/"><meta property="og:see_also" content="https://b.hui.ke/posts/windows-file-recovery-help/"><meta property="og:see_also" content="https://b.hui.ke/posts/bt-and-trojan/"><meta property="og:see_also" content="https://b.hui.ke/posts/steam-free-games-27/"><meta property="og:see_also" content="https://b.hui.ke/posts/build-trojan/"><meta property="og:see_also" content="https://b.hui.ke/posts/build-taobao-coupon-website/"><meta property="og:see_also" content="https://b.hui.ke/posts/build-ssr/"><meta property="og:see_also" content="https://b.hui.ke/posts/hello-everyone/"><script>!function(e){"use strict";!function(){var i,s=window,o=document,a=e,c="".concat("https:"===o.location.protocol?"https://":"http://","sdk.51.la/js-sdk-pro.min.js"),n=o.createElement("script"),r=o.getElementsByTagName("script")[0];n.type="text/javascript",n.setAttribute("charset","UTF-8"),n.async=!0,n.src=c,n.id="LA_COLLECT",a.d=n,i=function(){s.LA.ids.push(a)},s.LA?s.LA.ids&&i():(s.LA=e,s.LA.ids=[],i()),r.parentNode.insertBefore(n,r)}()}({id:"Jgb8aUbG5e3rqhrs",ck:"Jgb8aUbG5e3rqhrs",autoTrack:!0,hashMode:!0})</script><body class="flex min-h-screen flex-col"><header class="min-h-16 pl-scrollbar bg-secondary-bg fixed z-50 flex w-full items-center shadow-sm"><div class="mx-auto w-full max-w-screen-xl"><script>let storageColorScheme=localStorage.getItem("lightDarkMode");((storageColorScheme=="Auto"||storageColorScheme==null)&&window.matchMedia("(prefers-color-scheme: dark)").matches||storageColorScheme=="Dark")&&document.getElementsByTagName("html")[0].classList.add("dark")</script><nav class="flex items-center justify-between flex-wrap px-4 py-4 md:py-0"><a href=/ class="me-6 text-primary-text text-xl font-bold">Hui.Ke - Blog</a>
<button id=navbar-btn class="md:hidden flex items-center px-3 py-2" aria-label="Open Navbar">
<i class="fas fa-bars"></i></button><div id=target class="hidden block md:flex md:grow md:justify-between md:items-center w-full md:w-auto text-primary-text z-20"><div class="md:flex md:h-16 text-sm md:grow pb-4 md:pb-0 border-b md:border-b-0"><a href=/posts/ class="block mt-4 md:inline-block md:mt-0 md:h-(16-4px) md:leading-(16-4px) box-border md:border-t-2 md:border-b-2 selected-menu-item me-4">Posts</a>
<a href=/docs/ class="block mt-4 md:inline-block md:mt-0 md:h-(16-4px) md:leading-(16-4px) box-border md:border-t-2 md:border-b-2 border-transparent me-4">Docs</a>
<a href=/categories/ class="block mt-4 md:inline-block md:mt-0 md:h-(16-4px) md:leading-(16-4px) box-border md:border-t-2 md:border-b-2 border-transparent me-4">Categories</a>
<a href=/series/ class="block mt-4 md:inline-block md:mt-0 md:h-(16-4px) md:leading-(16-4px) box-border md:border-t-2 md:border-b-2 border-transparent me-4">Series</a>
<a href=/tags/ class="block mt-4 md:inline-block md:mt-0 md:h-(16-4px) md:leading-(16-4px) box-border md:border-t-2 md:border-b-2 border-transparent me-4">Tags</a>
<a href=/love/ class="block mt-4 md:inline-block md:mt-0 md:h-(16-4px) md:leading-(16-4px) box-border md:border-t-2 md:border-b-2 border-transparent me-4">Love</a>
<a href=/about/ class="block mt-4 md:inline-block md:mt-0 md:h-(16-4px) md:leading-(16-4px) box-border md:border-t-2 md:border-b-2 border-transparent me-4">About</a></div><div class=flex><div class="relative pt-4 md:pt-0"><div class="cursor-pointer hover:text-eureka" id=lightDarkMode><i class="fas fa-adjust"></i></div><div class="fixed hidden inset-0 opacity-0 h-full w-full cursor-default z-30" id=is-open></div><div class="absolute flex flex-col start-0 md:start-auto end-auto md:end-0 hidden bg-secondary-bg w-48 rounded py-2 border border-tertiary-bg cursor-pointer z-40" id=lightDarkOptions><span class="px-4 py-1 hover:text-eureka" name=Light>Light</span>
<span class="px-4 py-1 hover:text-eureka" name=Dark>Dark</span>
<span class="px-4 py-1 hover:text-eureka" name=Auto>Auto</span></div></div></div></div><div class="fixed hidden inset-0 opacity-0 h-full w-full cursor-default z-0" id=is-open-mobile></div></nav><script>let element=document.getElementById("lightDarkMode");storageColorScheme==null||storageColorScheme=="Auto"?document.addEventListener("DOMContentLoaded",()=>{window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",switchDarkMode)}):storageColorScheme=="Light"?(element.firstElementChild.classList.remove("fa-adjust"),element.firstElementChild.setAttribute("data-icon","sun"),element.firstElementChild.classList.add("fa-sun")):storageColorScheme=="Dark"&&(element.firstElementChild.classList.remove("fa-adjust"),element.firstElementChild.setAttribute("data-icon","moon"),element.firstElementChild.classList.add("fa-moon")),document.addEventListener("DOMContentLoaded",()=>{getcolorscheme(),switchBurger()})</script></div></header><main class="grow pt-16"><div class=pl-scrollbar><div class="mx-auto w-full max-w-screen-xl lg:px-4 xl:px-8"><div class="grid grid-cols-2 gap-4 lg:grid-cols-8 lg:pt-12"><div class="bg-secondary-bg col-span-2 rounded px-6 py-8 lg:col-span-6"><article class=prose><h1 class=mb-4>Vulfocus 搭建指南</h1><div class="text-tertiary-text not-prose mt-2 flex flex-row flex-wrap items-center"><div class="me-6 my-2"><i class="fas fa-calendar me-1"></i>
<span>2020-08-11</span></div><div class="me-6 my-2"><i class="fa-solid fa-pen-to-square me-1"></i>
<span>2020-08-11</span></div><div class="me-6 my-2"><i class="fas fa-clock me-1"></i>
<span>4 min read</span></div><div class="me-6 my-2"><i class="fas fa-folder me-1"></i>
<a href=https://b.hui.ke/categories/it/ class=hover:text-eureka>IT</a></div><div class="me-6 my-2"><i class="fas fa-th-list me-1"></i>
<a href=https://b.hui.ke/series/misc/ class=hover:text-eureka>Misc</a></div><div class="me-6 my-2"><i class="fa-solid fa-eye me-1"></i>
<span id=busuanzi_value_page_pv><i class="fa fa-spinner fa-spin"></i></span> Hits</div></div><p>  在 <a href=https://b.hui.ke/build-vulstudy/>搭建 vulstudy</a> 的时候无意间发现了一个好像可以作为 CTF 的平台“Vulfocus”，打算也搭一个试试。<a href=https://github.com/fofapro/vulfocus/blob/master/README.md>README</a> 里没看到安装说明，后来百度到了搭建指南在 <a href=https://github.com/fofapro/vulfocus/blob/master/INSTALL.md>INSTALL.md</a> 里，于是搬运过来作为博文，便于查看。<strong>直接搬运，内容未作改动</strong>。</p><blockquote><p>GitHub 项目地址： <a href=https://github.com/fofapro/vulfocus>fofapro/vulfocus</a></p></blockquote><h2 id=安装>安装</h2><p>系统为前后端分离项目，<code>vulfocus-api</code> 为后端项目、 <code>vulfocus-frontend</code> 为前端项目。</p><h3 id=快速安装>快速安装</h3><p>拉取 Vulfocus 镜像：</p><pre><code>docker pull vulfocus/vulfocus:latest
</code></pre><p>运行 Vulfocus</p><pre><code>docker create -p 80:80 -v /var/run/docker.sock:/var/run/docker.sock  -e VUL_IP=xxx.xxx.xxx.xxx vulfocus/vulfocus
docker start container id
</code></pre><p>或者</p><pre><code>docker run -d -p 80:80 -v /var/run/docker.sock:/var/run/docker.sock  -e VUL_IP=xxx.xxx.xxx.xxx vulfocus/vulfocus
</code></pre><ul><li><code>-v /var/run/docker.sock:/var/run/docker.sock</code> 为 docker 交互连接。</li><li><code>-e DOCKER_URL</code> 为 Docker 连接方式，默认通过 <code>unix://var/run/docker.sock</code> 进行连接，也可以通过 <code>tcp://xxx.xxx.xxx.xxx:2375</code> 进行连接（必须开放 2375 端口）。</li><li><code>-v /vulfocus-api/db.sqlite3:db.sqlite3</code> 映射数据库为本地文件。</li><li><code>-e VUL_IP=xxx.xxx.xxx.xxx</code> 为 Docker 服务器 IP ，不能为 127.0.0.1。</li><li>默认账户密码为 <code>admin/admin</code>。</li></ul><h3 id=自定义安装>自定义安装</h3><p><strong>以 Centos 7 为例主机已经关闭 <code>selinux</code></strong></p><p>环境：</p><ul><li>语言：python3</li><li>数据库：sqlite3、redis</li><li>框架：Django、Celery</li><li>API：djangorestframework</li><li>系统：Centos 7 , Other</li></ul><h4 id=安装依赖>安装依赖</h4><h5 id=安装需要的软件和开发环境>安装需要的软件和开发环境</h5><pre><code>yum -y install epel-release
yum install gcc -y
yum install  nginx supervisor net-tools wget git -y
yum install redis -y
</code></pre><h4 id=安装-docker>安装 docker</h4><h5 id=安装-docker-1>安装 docker</h5><p><a href=https://docs.docker.com/engine/install/>https://docs.docker.com/engine/install/</a></p><pre><code>yum install docker -y
</code></pre><h5 id=docker-配置>Docker 配置</h5><p>配置 Docker <code>2375</code> 端口（可根据实际情况进行修改），修改 docker 配置文件，加入以下信息：</p><p><strong>位置：</strong> <code>/usr/lib/systemd/system/docker.service</code></p><pre><code>ExecStart=/usr/bin/dockerd -H tcp://127.0.0.1:2375 -H unix://var/run/docker.sock \
</code></pre><p>或者</p><pre><code>/usr/bin/dockerd-current -H tcp://127.0.0.1:2375 -H unix://var/run/docker.sock \
</code></pre><p>重载配置文件</p><pre><code>systemctl daemon-reload
</code></pre><h4 id=安装-vulfocus-api>安装 Vulfocus API</h4><h5 id=安装-python3-不想源码编译>安装 Python3 (不想源码编译)</h5><pre><code class=language-shell>wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
chmod 755 Miniconda3-latest-Linux-x86_64.sh
./Miniconda3-latest-Linux-x86_64.sh  # 安装位置选  /opt/anaconda3/  
source ~/.bashrc
</code></pre><h5 id=更新-pip>更新 pip</h5><pre><code class=language-shell>/opt/anaconda3/bin/pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pip -U
/opt/anaconda3/bin/pip install virtualenv -i https://pypi.tuna.tsinghua.edu.cn/simple
</code></pre><h5 id=安装虚拟环境>安装虚拟环境</h5><pre><code>mkdir -p /data/{etc,log,tmp}
/opt/anaconda3/bin/virtualenv /data/venv_py --python=/opt/anaconda3/bin/python
echo &quot;source /data/venv_py/bin/activate&quot; &gt;&gt; ~/.bashrc
source ~/.bashrc
</code></pre><h5 id=拉取-vulfocus-和安装项目依赖>拉取 vulfocus 和安装项目依赖</h5><pre><code class=language-shell>cd /data
git clone https://github.com/fofapro/vulfocus.git web
cd /data/web/vulfocus-api/
pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
</code></pre><h4 id=数据库配置>数据库配置</h4><h5 id=如果使用mysql>如果使用mysql</h5><pre><code class=language-shell>yum install mysql-devel 
pip3 install mysqlclient -i https://pypi.tuna.tsinghua.edu.cn/simple
</code></pre><p>修改setting文件</p><pre><code class=language-shell>DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'vulfocus',
        'HOST':'127.0.0.1',
        'PORT':3306,
        'USER':'root',
        'PASSWORD':os.environ['MYSQLPWD']
    }
}

##bug MySQL does not allow unique CharFields to have a max_length &gt; 255
SILENCED_SYSTEM_CHECKS = ['mysql.E001']
</code></pre><h5 id=初始化数据库>初始化数据库</h5><pre><code class=language-shell>cd /data/web/vulfocus-api
python manage.py migrate
python manage.py createsuperuser
</code></pre><h5 id=靶场配置>靶场配置：</h5><ol><li><p>配置 Docker URL（<code>vulfocus/settings.py</code>），默认为：<code>tcp://127.0.0.1:2375</code>，修改为 Docker 服务器的 IP。</p></li><li><p>配置 VUL_IP（<code>vulfocus/settings.py</code>），修改为 Docker 服务器的 IP。</p></li><li><p>修改 CELERY_BROKER_URL（<code>vulfocus/settings.py</code>），修改为 Redis 连接地址。</p></li></ol><h5 id=启动-celerycelery不需要操做后面有自启>启动 Celery(Celery不需要操做后面有自启)</h5><p>在 <code>vulfocus-api</code> 中启动 Celery：</p><pre><code>celery -A vulfocus worker -l info -E
</code></pre><p>后端启动：</p><pre><code>celery multi start worker -A vulfocus -l info --logfile=celery.log
</code></pre><h5 id=安装uwsgi>安装uwsgi</h5><pre><code class=language-shell>pip install uwsgi -i https://pypi.tuna.tsinghua.edu.cn/simple
</code></pre><h6 id=uwsgi-配置>uwsgi 配置</h6><p><strong>位置：</strong> <code>/data/etc/vulfocus_uwsgi.ini</code></p><pre><code class=language-shell>[uwsgi]
uid=nginx
chdir = /data/web/vulfocus-api
;module = vulfocus.wsgi  
mount = /api=vulfocus.wsgi:application  # nginx配置子目录
manage-script-name = true
;route-run = fixpathinfo:  
home = /data/venv_py
socket = /data/tmp/vulfocus_uwsgi.sock
processes = 8
master = true
max-requests = 6000
chmod-socket = 777
vacuum = true
enable-threads = true
single-interpreter = true
</code></pre><h4 id=安装-vulfocus-frontend>安装 Vulfocus Frontend</h4><p>vulfocus 前端项目，通过 Element-ui + VUE 构建。</p><p>环境：</p><ul><li>UI：Element UI</li><li>框架：vue</li><li>node：v12.16.2</li><li>npm：6.14.4</li></ul><h5 id=项目构建>项目构建</h5><p>安装依赖：</p><pre><code class=language-shell>npm install 
</code></pre><p>构建项目：</p><pre><code>npm run build:prod
</code></pre><p>错误处理:</p><p><strong>node sass error</strong></p><pre><code>npm install -g yarn
yarn install node-sass
</code></pre><h5 id=发行版本>发行版本</h5><p>通过 <a href=https://github.com/fofapro/vulfocus/releases>https://github.com/fofapro/vulfocus/releases</a> 下载最新发布的版本。</p><h4 id=nginx-配置>nginx 配置</h4><p>配置上传文件大小，修改 <code>nginx.conf</code> 文件，http 中加入：</p><pre><code>client_max_body_size 4096M;
</code></pre><p>其中 4096M（4GB） 为上传文件最大限制，可根据实际进行修改，最小配置为 200M 。</p><h5 id=带证书多-vhost-的-nginx-配置文件>带证书多 vhost 的 nginx 配置文件</h5><p><strong>位置：</strong><code>/etc/nginx/conf.d/vulfocus.xxx.net.conf</code></p><pre><code>server {
    listen 80;
     server_name vulfocus.xxx.net;
     rewrite ^(.*) https://$host$1 permanent;
}
server{
listen 443 ssl http2;
server_name vulfocus.xxx.net;
ssl_certificate /etc/nginx/ssl/1_vulfocus.xxx.net_bundle.crt;
ssl_certificate_key /etc/nginx/ssl/2_vulfocus.xxx.net.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
ssl_prefer_server_ciphers on;
ssl_session_timeout 10m;
ssl_session_cache builtin:1000 shared:SSL:10m;
ssl_stapling on;
ssl_stapling_verify on;
client_max_body_size 2048M;
location /{
root /data/vulfocus/vulfocus-frontend/dist;
 index index.html;
}
location /api {
	      uwsgi_pass  unix://////data/tmp/vulfocus_uwsgi.sock;
        uwsgi_read_timeout 600;
        uwsgi_param SCRIPT_NAME /api;
        # the uwsgi_params file you installed
        include     /etc/nginx/uwsgi_params;
}
    access_log  /data/log/vulfocus.xxx.net.log;
    error_log  /data/log/vulfocus.xxx.net.log;
}
</code></pre><h5 id=不带证书仅有一个项目配置文件>不带证书仅有一个项目配置文件</h5><p><strong>位置：</strong><code>/etc/nginx/nginx.conf</code></p><pre><code>user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;

include /usr/share/nginx/modules/*.conf;

events {
    worker_connections 1024;
}

http {
    log_format  main  '$remote_addr - $remote_user [$time_local] &quot;$request&quot; '
                      '$status $body_bytes_sent &quot;$http_referer&quot; '
                      '&quot;$http_user_agent&quot; &quot;$http_x_forwarded_for&quot;';

    access_log  /var/log/nginx/access.log  main;

    sendfile            on;
    tcp_nopush          on;
    tcp_nodelay         on;
    keepalive_timeout   65;
    types_hash_max_size 2048;

    include             /etc/nginx/mime.types;
    default_type        application/octet-stream;

    include /etc/nginx/conf.d/*.conf;

    server {
        listen       80 default_server;
        listen       [::]:80 default_server;
        server_name  _;

        # Load configuration files for the default server block.
        include /etc/nginx/default.d/*.conf;

       location /{
           root /data/web/vulfocus-frontend/dist;
       index index.html;
       }
       location /api {
              uwsgi_pass  unix:/data/tmp/vulfocus_uwsgi.sock;
              uwsgi_read_timeout 600;
              uwsgi_param SCRIPT_NAME /api;
              include     /etc/nginx/uwsgi_params;
}
    access_log  /data/log/vulfocus.xxx.net.log;
    error_log  /data/log/vulfocus.xxx.net.log;

    }


}
</code></pre><h4 id=配置supervisor>配置supervisor</h4><p><strong>位置：</strong><code>/etc/supervisord.d/vulfoucs.ini</code></p><pre><code>[program:vulfocus]
directory=/data/venv_py
command=/data/venv_py/bin/uwsgi --ini /data/etc/vulfocus_uwsgi.ini
numprocs=1
user=nginx
startretries=3
startsecs=5
autostart=true
autorestart=true
stopsignal=INT
stopasgroup=true
killasgroup=true
redirect_stderr=true
stdout_logfile=/data/log/vulfoucs_uwsgi.log
</code></pre><p><strong>位置：</strong><code>/etc/supervisord.d/celery.ini</code></p><pre><code>[program:celeryworker]
command=/data/venv_py/bin/celery -A vulfocus worker -l info -E
directory=/data/web/vulfocus-api
user=nginx
numprocs=1
stdout_logfile=/data/log/worker_celery.log
redirect_stderr=true
autostart=true
autorestart=true
startsecs=10
stopasgroup=true
priority=999
</code></pre><h4 id=权限以及自启>权限以及自启</h4><pre><code>chown -R nginx. /data
</code></pre><p>使用 <code>unix://var/run/docker.sock</code> <strong>连接 docker 需要配置</strong> 使用 tcp 套接字无需修改</p><pre><code>groupadd docker
usermod -aG docker nginx
systemctl restart docker
</code></pre><h5 id=开机自启动>开机自启动</h5><pre><code>systemctl enable nginx
systemctl enable supervisord
systemctl enable docker
systemctl enable redis
</code></pre><h5 id=启动>启动</h5><pre><code>systemctl start supervisord
systemctl start nginx
systemctl start docker
systemctl start redis
</code></pre><h5 id=防火墙配置>防火墙配置</h5><pre><code class=language-shell>firewall-cmd --add-port=80/tcp --permanent
firewall-cmd --add-port=443/tcp --permanent
systemctl restart firewalld.service
</code></pre><h4 id=问题>问题</h4><p>拉取镜像会报 500 错误这个是 <code>/var/run/docker.sock</code> 权限问题</p><p>三种解决方案</p><ol><li><p>修改 <code>/etc/supervisord.d/vulfoucs.ini</code> 配置文件</p><pre><code># user=nginx # 改前
user=root # 改后
</code></pre></li><li><p>配置 Docker URL（<code>vulfocus/settings.py</code>），启用 <code>tcp://127.0.0.1:2375</code></p></li><li><p>添加 docker 用户组把 nginx 用户加进去</p><pre><code>groupadd docker
usermod -aG docker nginx
systemctl restart docker
</code></pre></li></ol><blockquote><p><a href=https://fofapro.github.io/vulfocus/#/>Vulfocus 官方文档</a></p></blockquote></article><div class=my-4><a href=https://b.hui.ke/tags/vulfocus/ class="inline-block bg-tertiary-bg text-sm rounded px-3 py-1 my-1 me-2 hover:text-eureka">#vulfocus</a>
<a href=https://b.hui.ke/tags/docker/ class="inline-block bg-tertiary-bg text-sm rounded px-3 py-1 my-1 me-2 hover:text-eureka">#Docker</a></div><div class=py-2><div class="my-8 flex flex-col items-center md:flex-row"><a href=https://b.hui.ke/authors/hui.ke/ class="md:me-4 text-primary-text h-24 w-24"><img src=https://b.hui.ke/bagua.webp class="bg-primary-bg w-full rounded-full" alt=Avatar></a><div class="mt-4 w-full md:mt-0 md:w-auto"><a href=https://b.hui.ke/authors/hui.ke/ class="mb-2 block border-b pb-1 text-lg font-bold"><h3>Hui.Ke</h3></a><span class="block pb-2">❤ Cyber Security | Safety is a priority.</span>
<a href=mailto:3199731997@qq.com class=me-2><i class="fas fa-envelope"></i></a>
<a href="https://wpa.qq.com/msgrd?v=3&uin=3199731997" class=me-2><i class="fab fa-qq"></i></a>
<a href=/images/aixinxianquan.webp class=me-2><i class="fab fa-weixin"></i></a></div></div></div><div class="-mx-2 mt-4 flex flex-col border-t px-2 pt-4 md:flex-row md:justify-between"><div><span class="text-primary-text block font-bold">Previous</span>
<a href=https://b.hui.ke/posts/cdn-nodes/ class=block>CDN 节点 IP</a></div><div class="mt-4 md:mt-0 md:text-right"><span class="text-primary-text block font-bold">Next</span>
<a href=https://b.hui.ke/posts/build-vulstudy/ class=block>搭建 vulstudy</a></div></div><div id=valine-comments class=mt-4></div><script defer src=https://cdn.jsdelivr.net/npm/valine@1.4.16/dist/Valine.min.js integrity=sha384-e0+DNUCJo75aOAzHQbFWYBCM9/S4f0BhRJXvEgbE3mMS85RM20MSSGStHuNdY2QK crossorigin></script>
<script>document.addEventListener("DOMContentLoaded",function(){new Valine({el:"#valine-comments",appId:"BQnVqWIiq78AdqwyhvBVAa3y-MdYXbMMI",appKey:"RKg5By312YjM8rU6WkkfK9IN",recordIP:"true",serverURLs:"https://l.hui.ke",visitor:"true"})})</script></div><div class=col-span-2><div class="bg-secondary-bg prose max-w-none rounded p-6"><h3>Series of Posts</h3><a href=https://b.hui.ke/posts/data-security-and-personal-information-protection/ class=no-underline>数据安全 & 个人信息保护</a><br><a href=https://b.hui.ke/posts/mp-1/ class=no-underline>密评从零到 0.001</a><br><a href=https://b.hui.ke/posts/regedit-delete-startup-item/ class=no-underline>注册表删启动项</a><br><a href=https://b.hui.ke/posts/ols-wordpress/ class=no-underline>WordPress + OLS</a><br><a href=https://b.hui.ke/posts/epidemic-prevention-and-cyber-security/ class=no-underline>防疫 & 网络安全</a><br><a href=https://b.hui.ke/posts/comparison-of-thin-light-laptops/ class=no-underline>轻薄本对比</a><br><a href=https://b.hui.ke/posts/sangfor-pt1/ class=no-underline>Sangfor PT1 Certification</a><br><a href=https://b.hui.ke/posts/minutes-of-general-manager-xus-meeting-on-monday/ class=no-underline>周一徐总会议纪要</a><br><a href=https://b.hui.ke/posts/my-github-stars/ class=no-underline>我的 GitHub 星标项目</a><br><a href=https://b.hui.ke/posts/raspberry-pi-motion/ class=no-underline>树莓派运动监测和录制</a><br><a href=https://b.hui.ke/posts/transfer-files-with-rsync/ class=no-underline>使用 rsync SSH 传输文件</a><br><a href=https://b.hui.ke/posts/comparison-of-iflytek-mice/ class=no-underline>科大讯飞鼠标参数对比</a><br><a href=https://b.hui.ke/posts/resolutions-for-vmware-tools-installation-failure/ class=no-underline>VMware Tools 安装失败的解决办法</a><br><a href=https://b.hui.ke/posts/raspberry-pi-intranet-penetration/ class=no-underline>树莓派内网穿透</a><br><a href=https://b.hui.ke/posts/image-and-video-optimization/ class=no-underline>网站图片、视频优化处理</a><br><a href=https://b.hui.ke/posts/ccia-top-50-2020/ class=no-underline>2020 年 CCIA 中国网络安全竞争力 50 强榜单</a><br><a href=https://b.hui.ke/posts/cdn-nodes/ class=no-underline>CDN 节点 IP</a><br><a href=https://b.hui.ke/posts/vulfocus-building-guide/ class=no-underline>Vulfocus 搭建指南</a><br><a href=https://b.hui.ke/posts/build-vulstudy/ class=no-underline>搭建 vulstudy</a><br><a href=https://b.hui.ke/posts/windows-file-recovery-help/ class=no-underline>Windows File Recovery 使用帮助</a><br><a href=https://b.hui.ke/posts/bt-and-trojan/ class=no-underline>在宝塔上制作酸酸乳</a><br><a href=https://b.hui.ke/posts/steam-free-games-27/ class=no-underline>Steam 免费游戏 代码一键领取 27 个</a><br><a href=https://b.hui.ke/posts/build-trojan/ class=no-underline>制作“保质期长的”酸酸乳</a><br><a href=https://b.hui.ke/posts/build-taobao-coupon-website/ class=no-underline>搭建淘宝领券网</a><br><a href=https://b.hui.ke/posts/build-ssr/ class=no-underline>制作酸酸乳</a><br><a href=https://b.hui.ke/posts/hello-everyone/ class=no-underline>名言警句</a><br></div><div class="bg-primary-bg
prose sticky top-16 z-10 hidden px-6 py-4 lg:block"><h3>On This Page</h3></div><div class="sticky-toc hidden px-6 pb-6 lg:block"><nav id=TableOfContents><ul><li><a href=#安装>安装</a><ul><li><a href=#快速安装>快速安装</a></li><li><a href=#自定义安装>自定义安装</a><ul><li><a href=#安装依赖>安装依赖</a><ul><li><a href=#安装需要的软件和开发环境>安装需要的软件和开发环境</a></li></ul></li><li><a href=#安装-docker>安装 docker</a><ul><li><a href=#安装-docker-1>安装 docker</a></li><li><a href=#docker-配置>Docker 配置</a></li></ul></li><li><a href=#安装-vulfocus-api>安装 Vulfocus API</a><ul><li><a href=#安装-python3-不想源码编译>安装 Python3 (不想源码编译)</a></li><li><a href=#更新-pip>更新 pip</a></li><li><a href=#安装虚拟环境>安装虚拟环境</a></li><li><a href=#拉取-vulfocus-和安装项目依赖>拉取 vulfocus 和安装项目依赖</a></li></ul></li><li><a href=#数据库配置>数据库配置</a><ul><li><a href=#如果使用mysql>如果使用mysql</a></li><li><a href=#初始化数据库>初始化数据库</a></li><li><a href=#靶场配置>靶场配置：</a></li><li><a href=#启动-celerycelery不需要操做后面有自启>启动 Celery(Celery不需要操做后面有自启)</a></li><li><a href=#安装uwsgi>安装uwsgi</a><ul><li><a href=#uwsgi-配置>uwsgi 配置</a></li></ul></li></ul></li><li><a href=#安装-vulfocus-frontend>安装 Vulfocus Frontend</a><ul><li><a href=#项目构建>项目构建</a></li><li><a href=#发行版本>发行版本</a></li></ul></li><li><a href=#nginx-配置>nginx 配置</a><ul><li><a href=#带证书多-vhost-的-nginx-配置文件>带证书多 vhost 的 nginx 配置文件</a></li><li><a href=#不带证书仅有一个项目配置文件>不带证书仅有一个项目配置文件</a></li></ul></li><li><a href=#配置supervisor>配置supervisor</a></li><li><a href=#权限以及自启>权限以及自启</a><ul><li><a href=#开机自启动>开机自启动</a></li><li><a href=#启动>启动</a></li><li><a href=#防火墙配置>防火墙配置</a></li></ul></li><li><a href=#问题>问题</a></li></ul></li></ul></li></ul></nav></div><script>window.addEventListener("DOMContentLoaded",()=>{enableStickyToc()})</script></div><div class="bg-secondary-bg prose col-span-2 rounded p-6 lg:col-span-6"><h3>See Also</h3><a href=https://b.hui.ke/posts/build-vulstudy/ class=no-underline>搭建 vulstudy</a><br></div></div><script>document.addEventListener("DOMContentLoaded",()=>{hljs.highlightAll()})</script></div></div></main><footer class=pl-scrollbar><div class="mx-auto w-full max-w-screen-xl"><div class="text-center p-6 pin-b"><script async src=/js/click.js></script><div id=poem_ip></div><script type=text/javascript>jinrishici.load(function(e){tags.innerHTML=e.data.matchTags})</script><div><span id=timeDate>载入年天数...</span><span id=times>载入时分秒...</span>
<script async src=/js/duration.js></script></div><a href=https://www.foreverblog.cn/go.html target=_blank><img src=https://img.foreverblog.cn/wormhole_4_tp.gif alt style=display:inline-block;width:auto;height:32px title=穿梭虫洞-随机访问十年之约友链博客></a><p class="text-sm text-tertiary-text"><script async src=//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js></script>本站总访问量 <span id=busuanzi_value_site_pv></span> 次
&#183; 您是本站的第 <span id=busuanzi_value_site_uv></span> 个小伙伴</p><script async src=/js/tab.js></script></div></div></footer></body></html>